Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

294
Views
Mysql "Seleccionar mod (col1, 10) ... " genera bigint. Cómo hacer que sea de tipo int

tengo el siguiente código

 String sql = "(select mod_col, 1 as count_col from ( " + "select mod(col1, 10) as mod_col " + "from table1 c " + "where c.col2 = 1) temp " + "group by mod_col, count_col ) as temp2"; DataFrame df = getDSEDataFrame(sql);

Tenga en cuenta que col1 está definido en mysql con tipo int(11) NOT NULL .

Sin embargo, cuando compruebo el df, mod_col tiene el valor correcto como bigint. Esto causa una excepción java.math.BigDecimal cannot be cast to java.lang.Integer para mi siguiente código

 List<Row> col1List = df.collectAsList(); for (Row r : col1List) { Integer col1Val = r.getAs("mod_col"); // exception thrown here }

¿Hay alguna forma en el sql anterior de que pueda obligarlo a devolver un número entero en lugar de un número entero grande?

over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!